package org.ggn.model;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name="t_course")
public class Course {
	private int id;
	private String name;
	private String shortname;
	private String exam_info;
	private String paper_year_an;
	private String paper_year_noan;
	private Grade grade;
	
	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getExam_info() {
		return exam_info;
	}
	public void setExam_info(String exam_info) {
		this.exam_info = exam_info;
	}
	public String getpaper_year_an() {
		return paper_year_an;
	}
	public void setpaper_year_an(String paper_year_an) {
		this.paper_year_an = paper_year_an;
	}
	public String getpaper_year_noan() {
		return paper_year_noan;
	}
	public void setpaper_year_noan(String paper_year_noan) {
		this.paper_year_noan = paper_year_noan;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="gid")
	@Fetch(FetchMode.JOIN)
	public Grade getGrade() {
		return grade;
	}
	public void setGrade(Grade grade) {
		this.grade = grade;
	}
	public String getShortname() {
		return shortname;
	}
	public void setShortname(String shortname) {
		this.shortname = shortname;
	}
	
	public Course() {
		super();
	}
	public Course(String name, String shortname, Grade grade) {
		this.name = name;
		this.grade = grade;
		this.shortname = shortname;
	}
	
}
